﻿using System.Collections.Generic;
using System.IO;
using EnvDTE;

namespace SolutionFactory.Services
{
    public static class SolutionExtensions
    {
        public static string GetStartUpProject(this Solution solution)
        {
            return solution.Properties.Item("StartupProject").Value.ToString();
        }

        public static string GetDirectoryName(this Solution solution)
        {
            string solutionDir = Path.GetDirectoryName(solution.FileName);
            string[] rootDirArray = solutionDir.Split('\\');
            string targetSolutionRootDir = "";
            if (rootDirArray.Length > 1)
            {
                targetSolutionRootDir = rootDirArray[rootDirArray.Length - 1];
            }
            return targetSolutionRootDir;
        }

    }
}